#include <iostream>
using namespace std;
typedef struct Image {
    int l;
    int w;
    float** pixel;
} Image;
void Create_Image(Image* image) {
    cout << "请输入图像的长和宽：" << endl;
    cin >> image->l >> image->w;
    image->pixel = NULL;
    image->pixel = new float*[image->l];
    for (int i = 0; i < image->l; i++) {
        image->pixel[i] = new float[image->w];
    }
    cout << "请按顺序输入每个坐标下的灰度值：(0-255)" << endl;
    for (int i = 0; i < image->l; i++) {
        for (int j = 0; j < image->w; j++) {
            cin >> image->pixel[i][j];
            cout << " ";
        }
        cout << endl;
    }
}
void Print_Image(Image* image) {
    for (int i = 0; i < image->l; i++) {
        for (int j = 0; j < image->w; j++) {
            cout << image->pixel[i][j];
            cout << " ";
        }
        cout << endl;
    }
}
void Reverse_Image(Image* image1, Image* image2) {
    image2->l = image1->l;
    image2->w = image1->w;
    image2->pixel = NULL;
    image2->pixel = new float*[image2->l];
    for (int i = 0; i < image2->l; i++) {
        image2->pixel[i] = new float[image2->w];
    }
    for (int i = 0; i < image1->l; i++) {
        for (int j = 0; j < image1->w; j++) {
            image2->pixel[i][j] = 255 - image1->pixel[i][j];
        }
    }
}
void Delete_Image(Image* image) {
    for (int i = 0; i < image->l; i++) {
        delete[] image->pixel[i];
    }
    delete[] image->pixel;
}